package com.zatech.cgnci.project.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @author EDY
 * @version 1.0
 * Create by 2024/12/18 14:54
 */
@Data
@ApiModel(value = "CgnciAnnualInsurePlanMainSaveOrUpdateDTO")
public class CgnciAnnualInsurePlanSaveOrUpdateDTO {

    @ApiModelProperty(value = "工作流类型,固定值:submit")
    private String flowTaskType;

    @ApiModelProperty(value = "任务流程id")
    @NotNull(message = "approvalInfoId cannot be null")
    private Long approvalInfoId;

    @ApiModelProperty(value = "基本信息")
    @Valid
    private CgnciAnnualInsurePlanUpdateDTO annualInsurePlanUpdateDTO;

    @ApiModelProperty(value = "最大净自留限额")
    @Valid
    private List<ReinsureRiskDTO> reinsureRiskDTOList;

    @ApiModelProperty(value = "文件清单")
    private List<AccessoryDTO> accessoryDTOList;

    @Data
    public static class CgnciAnnualInsurePlanUpdateDTO {

        @ApiModelProperty(value = "年度承保id")
        private Long inPlanId;

        @ApiModelProperty(value = "年度名称")
        private String planName;

        @ApiModelProperty(value = "业务年度")
        private String annual;

        @ApiModelProperty(value = "生效日期")
        @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT-8")
        private Date effectiveTime;

    }

    @Data
    public static class ReinsureRiskDTO {

        @ApiModelProperty("id")
        private Long id;

        @ApiModelProperty("配置险类id(cgnci_risk.id)")
        private Long riskId;

        @ApiModelProperty("险类")
        private String riskClass;

        @ApiModelProperty("险类代码")
        private String riskClassCode;

        @ApiModelProperty("险种")
        private String riskSubType;

        @ApiModelProperty("险种代码")
        private String riskSubTypeCode;

        @ApiModelProperty("最大自留额(人民币)")
        @DecimalMin(value = "0", message = "最大自留额(人民币)必须大于0")
        private BigDecimal insuredAmountRmb;

        @ApiModelProperty("最大自留额(美元)")
        @DecimalMin(value = "0", message = "最大自留额(美元)必须大于0")
        private BigDecimal insuredAmountDollar;

    }

    @Data
    public static class AccessoryDTO {

        @NotNull(message = "文件id不能为空")
        @ApiModelProperty(value = "文件id")
        private Long accId;

        @ApiModelProperty(value = "业务编号(关联业务表主键id)", hidden = true)
        private Long businessId;

        @ApiModelProperty(value = "业务号", hidden = true)
        private String businessNo;

        @ApiModelProperty(value = "业务类型（根据业务自定义业务类型进行区分）", hidden = true)
        private String businessType;

        @ApiModelProperty(value = "文件类型", hidden = true)
        private String accType;

        @ApiModelProperty(value = "上传节点", hidden = true)
        private String uploadNode;

        @ApiModelProperty(value = "附件云编号", hidden = true)
        private String fileId;

        @ApiModelProperty(value = "附件名称", hidden = true)
        private String fileName;

        @ApiModelProperty(value = "附件类型", hidden = true)
        private String fileType;

        @ApiModelProperty(value = "有效起期", hidden = true)
        private Date startTime;

        @ApiModelProperty(value = "有效止期", hidden = true)
        private Date endTime;

        @ApiModelProperty(value = "上传时间", hidden = true)
        private Date uploadTime;

        @ApiModelProperty(value = "状态（0：失败，1：成功）", hidden = true)
        private String status;

        @ApiModelProperty(value = "操作结果描述", hidden = true)
        private String msg;

        @ApiModelProperty(value = "删除标志位（0：未删除，1：已删除）", hidden = true)
        private Integer dr;

    }
}
